package com.infore.siteManagement.entity.equipment;

import java.io.Serializable;
import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.infore.siteManagement.entity.Project;
import com.infore.siteManagement.entity.SiteBasicFile;

import java.util.Date;
import java.util.Set;

/**
 * The persistent class for the EQUIPMENT_SAMPLE database table. 仪器实例表
 */
@Entity
@Table(name = "EQUIPMENT_SAMPLE")
@NamedQuery(name = "EquipmentSample.findAll", query = "SELECT e FROM EquipmentSample e")
public class EquipmentSample implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "ID")
//	@GeneratedValue(generator = "uuidGenerator")
//	@GenericGenerator(name = "uuidGenerator", strategy = "uuid") // UUID生成策略
	private String id;

	/** 仪器模板id **/
	@Column(name = "EQUIPMENT_MODEL_ID")
	private String equipmentModelId;

	/** 出厂编号 **/
	@Column(name = "FACTORY_CODE")
	private String factoryCode;

	/** 安装时间 **/
	@Temporal(TemporalType.DATE)
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	@Column(name = "INSTALL_DATE")
	private Date installDate;

	/** 是否启用 **/
	@Column(name = "IS_ENABLE")
	private String isEnable;

	/** 生产日期 **/
	@Temporal(TemporalType.DATE)
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	@Column(name = "PRODUCED_DATE")
	private Date producedDate;

	/** 站点mn **/
	@Column(name = "STATION_MN")
	private String stationMn;

	@Column(name="EQUIP_MODEL")
	private String equipModel;
	
	/** 仪器模板 **/
	@ManyToOne
	@JoinColumn(name = "EQUIPMENT_MODEL_ID", referencedColumnName = "ID", insertable = false, updatable = false)
	private EquipmentModel equipmentModel;

	/**监测因子**/
	@ManyToMany(targetEntity = Project.class)
	@JoinTable(name = "EQUIP_SAMPLE_AND_PROJECT", joinColumns = {
			@JoinColumn(name = "EQUIP_SAMPLE_ID", referencedColumnName = "ID") }, inverseJoinColumns = {
					@JoinColumn(name = "PROJECT_CODE", referencedColumnName = "PROJECT_CODE") })
	private Set<Project> projects;

	/**仪器实例二维码**/
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = "EQUIP_SAMPLE_QRCODE", referencedColumnName = "ID", insertable = false, updatable = false)
	private Set<SiteBasicFile> qrCodes;

	public EquipmentSample() {
	}

	public Set<SiteBasicFile> getQrCodes() {
		return qrCodes;
	}

	public String getEquipModel() {
		return equipModel;
	}

	public void setEquipModel(String equipModel) {
		this.equipModel = equipModel;
	}

	public void setQrCodes(Set<SiteBasicFile> qrCodes) {
		this.qrCodes = qrCodes;
	}

	public Set<Project> getProjects() {
		return projects;
	}

	public void setProjects(Set<Project> projects) {
		this.projects = projects;
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getEquipmentModelId() {
		return equipmentModelId;
	}

	public void setEquipmentModelId(String equipmentModelId) {
		this.equipmentModelId = equipmentModelId;
	}

	public EquipmentModel getEquipmentModel() {
		return equipmentModel;
	}

	public void setEquipmentModel(EquipmentModel equipmentModel) {
		this.equipmentModel = equipmentModel;
	}

	public String getFactoryCode() {
		return this.factoryCode;
	}

	public void setFactoryCode(String factoryCode) {
		this.factoryCode = factoryCode;
	}

	public Date getInstallDate() {
		return this.installDate;
	}

	public void setInstallDate(Date installDate) {
		this.installDate = installDate;
	}

	public String getIsEnable() {
		return this.isEnable;
	}

	public void setIsEnable(String isEnable) {
		this.isEnable = isEnable;
	}

	public Date getProducedDate() {
		return this.producedDate;
	}

	public void setProducedDate(Date producedDate) {
		this.producedDate = producedDate;
	}

	public String getStationMn() {
		return this.stationMn;
	}

	public void setStationMn(String stationMn) {
		this.stationMn = stationMn;
	}

}